package com.ztk.threadbasic.excel;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

@Data
public class CompanyVO {
    /*
        预算机构
        由于表格是不规则的，故需要手动将第一行的数据提取出来，所以需要将这两个字段忽略掉
     不通过easyExcel自动解析进该实体中。
     */
    @ExcelIgnore
    private String budgetAgency;

    // 预算时间
    @ExcelIgnore
    private String budgetDate;

    // 项目（单位：万元）第一列
    @ExcelProperty(index = 0)
    private String project;

    // 项目（单位：万元） 第二列
    @ExcelProperty(index = 1)
    private String projectDetail;

    // 整体
    @ExcelProperty
    private Double entirety;

    // 信保板块
    @ExcelProperty
    private Double creditInsuranceSector;

    // 整体（不含信保）
    @ExcelProperty
    private Double overallExcludingCreditInsurance;

    // 传统板块
    @ExcelProperty
    private Double traditionalsector;

    // 传统个险(含健康险）
    @ExcelProperty
    private Double traditionalIndividualInsuranceWithHealth;

    // 传统个险(不含健康险）
    @ExcelProperty
    private Double traditionalIndividualInsuranceWithoutHealth;

    // 车险
    @ExcelProperty
    private Double vehicleInsurance;

    // 家财险
    @ExcelProperty
    private Double homeFinancialInsurance;

    // 意外险
    @ExcelProperty
    private Double accidentInsurance;

    // 健康险
    @ExcelProperty
    private Double healthInsurance;

    // 健康险-政保
    @ExcelProperty
    private Double healthInsuranceGovernmental;

    // 健康险-高端医疗
    @ExcelProperty
    private Double highEndMedicalHealthInsurance;

    // 健康险-其他
    @ExcelProperty
    private Double otherHealthInsurance;

    // 传统商水
    @ExcelProperty
    private Double commercialWaterInsurance;

    // 传统商险
    @ExcelProperty
    private Double traditionalCommercialInsurance;

    // 企财险
    @ExcelProperty
    private Double enterprisePropertyInsurance;

    // 工程险
    @ExcelProperty
    private Double engineeringInsurance;

    // 其他险
    @ExcelProperty
    private Double otherInsurance;

    // 特风险
    @ExcelProperty
    private Double specialRiskInsurance;

    // 商责险
    @ExcelProperty
    private Double commercialLiabilityInsurance;

    // 非融资保证险
    @ExcelProperty
    private Double nonFinancingGuaranteeInsurance;

    // 传统水险
    @ExcelProperty
    private Double traditionalWaterInsurance;

    // 船舶险
    @ExcelProperty
    private Double marineInsurance;

    // 货运险
    @ExcelProperty
    private Double cargoInsurance;

    // 航责险
    @ExcelProperty
    private Double aviationLiabilityInsurance;

    // 传统农险
    @ExcelProperty
    private Double traditionalAgriculturalInsurance;

    // 资管中心
    @ExcelProperty
    private Double assetManagementCenter;

    // 创建人
    @ExcelIgnore
    private String createUser;

    // 创建时间
    @ExcelIgnore
    private Date createDate = new Date();


    /**
     * 判断当前对象是否不为空，判断时，需要除去budgetAgency， budgetAgency， createUser， createDate
     * @return
     */
    public boolean notEmpty() {
        String thisJSON = JSON.toJSONString(this);
        CompanyVO budgetMonitorVo = JSON.parseObject(thisJSON, CompanyVO.class);
        budgetMonitorVo.setBudgetAgency(null);
        budgetMonitorVo.setBudgetAgency(null);
        budgetMonitorVo.setCreateUser(null);
        budgetMonitorVo.setCreateDate(null);
        return Objects.isNull(budgetMonitorVo) ? false : true;
    }
}
